<?php
declare (strict_types = 1);
namespace app\user\service\user;

use app\common\service\BaseService;
use think\facade\Request;
use app\user\logic\user\Credit as CreditLogic;
use app\user\logic\user\CreditFlow;

/**
 * 用户积分接口类
 */
class Credit extends BaseService
{

    public function infoAndIncrease()
    {
        $data = app(CreditLogic::class)->infoAndIncrease();

        return $this->parseToData($data, 1, '获取成功');
    }

    public function flow()
    {
    	$flow = app(CreditFlow::class)->flow();
        return $this->parseToData($flow, 1, '获取成功');
    }

    public function recharge()
    {
        $param = Request::post();
        $re    = app(CreditLogic::class)->recharge($param);
        return $this->parseToData($re, 1, '交易完成');
    }

    /**
     * 用户积分主页
     * Author 亓官雨树<lucky.max@foxmail.com>
     * Date 2021-08-23
     * @return [type] [description]
     */
    public function base()
    {
        $data = app(CreditLogic::class)->base();

        return $this->parseToData($data, 1, '获取成功');
    }

    public function signIn()
    {
        $data = app(CreditLogic::class)->signIn();

        return $this->parseToData($data, 1, '签到成功');
    }
}
